package calorie.com.calorie.contact;


import com.lxh.baselibray.mvp.BasePresent;
import com.lxh.baselibray.mvp.IBaseView;
import com.lxh.baselibray.net.NetCallBack;
import com.lxh.baselibray.net.ServiceGenerator;

import calorie.com.calorie.api.ApiService;
import calorie.com.calorie.request.ActivationUserRequest;
import calorie.com.calorie.response.ResultDTO;
import retrofit2.Call;
import retrofit2.Response;

public class ActivationUserContact {
    public static class ActivationUserPresent extends BasePresent<IActivationUserView> {
        public void activation(String realName, String identityNum,  String email, String weight, String height, String receivingAddress, Integer userId) {
            ApiService service = ServiceGenerator.createService(ApiService.class);
            ActivationUserRequest request = new ActivationUserRequest(realName, identityNum, email,  weight, height, receivingAddress,userId);
            service.activationUser(request).enqueue(new NetCallBack<ResultDTO>() {
                @Override
                public void onSuccess(Call<ResultDTO> call, Response<ResultDTO> response) {
                     if(getView()!=null)
                      getView().getResultDate(response);
                }

                @Override
                public void onFailed() {

                }
            });
        }

    }

    public interface IActivationUserView extends IBaseView {
           void getResultDate(Response<ResultDTO> resultDTOResponse);
    }
}
